//初始化数据
const state = {
    campus: JSON.parse(sessionStorage.getItem('campus')),
    school_id: JSON.parse(sessionStorage.getItem('school_id'))
}

//向外输出数据
const getters = {
    campus: (state) => {
        return state.campus
    },
    school_id: (state) => {
        return state.school_id
    }
}

//异步操作，第一个参数 同步：action.commit() 异步：action.dispatch()
const actions = {

}

//mutations
const mutations = {
    // 切换校区
    changeSchoolId(state,id){
        state.school_id = id;
    },
    // 更新校区
    changeCampus(state,data){
        state.campus = data;
    }
}

export default{
    state,
    getters,
    actions,
    mutations
}